package com.dotstone.chipism.ui.security.fragment;

import android.content.Intent;
import android.view.View;

import com.dotstone.chipism.R;
import com.dotstone.chipism.base.LazyFragment;
import com.dotstone.chipism.ui.security.ActivityGuideDeviceSetupAlarm;
import com.dotstone.chipism.ui.security.ActivityGuideDeviceSetupCamera;
import com.dotstone.chipism.ui.security.ActivityGuideDeviceSetupStorage;
import com.dotstone.chipism.ui.security.ActivityGuideDeviceSystemInfo;
import com.dotstone.chipism.ui.security.me.DeviceCameraMainActivity;
import com.dotstone.chipism.ui.security.setting.SettingActivity;
import com.dotstone.chipism.util.SPUtils;
import com.lib.funsdk.support.utils.SPUtil;

/**
 * 设置
 */
public class DeviceSettingFragment extends LazyFragment implements View.OnClickListener{


    @Override
    public int getLayoutId() {
        return R.layout.fragment_device_camera_setting;
    }


    @Override
    public void onFirstUserVisible() {

        getView().findViewById(R.id.rl_setting).setOnClickListener(this);
        getView().findViewById(R.id.rl_alert).setOnClickListener(this);
        getView().findViewById(R.id.rl_sd).setOnClickListener(this);
        getView().findViewById(R.id.rl_high).setOnClickListener(this);
        getView().findViewById(R.id.rl_info).setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rl_setting:
                start( ActivityGuideDeviceSetupCamera.class);
                break;
            case R.id.rl_alert:
                start( ActivityGuideDeviceSetupAlarm.class);
                break;
            case R.id.rl_sd:
                start( ActivityGuideDeviceSetupStorage.class);

                break;
            case R.id.rl_high:
//                start( ActivityGuideDeviceSetupCamera.class);

                break;
            case R.id.rl_info:
                start( ActivityGuideDeviceSystemInfo.class);

                break;
        }
    }

    private void start(Class<?> cla) {
        Intent intent = new Intent(getContext(),cla);
//        int devId = getActivity().getIntent().getIntExtra("FUN_DEVICE_ID", 0);
        String devMac = (String) SPUtils.get(getContext(),"FUN_DEVICE_MAC","");
        intent.putExtra("FUN_DEVICE_MAC",devMac);
        startActivity(intent);
    }
}
